<template>
  <el-container style="height: 700px; border: 1px solid #eee">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-menu :default-openeds="['1', '3']" router>
        <el-submenu index="1">
          <template slot="title"><i class="el-icon-message"></i>用户管理</template>
          <el-menu-item index="/userList">用户列表</el-menu-item>
        </el-submenu>
        <el-submenu index="2">
          <template slot="title"><i class="el-icon-menu"></i>图书管理</template>
          <el-menu-item index="/book-management">图书列表</el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <el-button type="text" @click="handleLogin">登录</el-button>
        <el-button type="text" @click="handleRegister">注册</el-button>
      </el-header>

      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  methods: {
    handleLogin() {
      // 登录逻辑
      console.log('登录');
      this.$router.push('/login');
    },
    handleRegister() {
      // 注册逻辑
      console.log('注册');
      this.$router.push('/register');
    }
  },
};
</script>

<style>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}

.el-button--text {
  margin-right: 15px;
}
</style>
